Imports Castle.ActiveRecord
Imports NHibernate


''' <summary>
'''	Gerado por MyGeneration usando o template ActiveRecord Object Mapper-1.0.3
'''	Criado em 14/08/2010 00:29:39
''' </summary>
''' <remarks></remarks>

<Serializable(), ActiveRecord("perfilpermissao", DynamicUpdate:= true)> _
Public Class Perfilpermissao
    Inherits ActiveRecordBase
	
    Private _cd_perfilpermissao As Integer
	Private _perfilpermissao_status As Short

    Private _Perfil As Perfil
    Private _Permissao As Permissao



	<PrimaryKey(PrimaryKeyType.Sequence, SequenceName:="perfilpermissao_cd_perfilpermissao_seq")> _
	Public Property cd_perfilpermissao() As Integer
		Get
			Return _cd_perfilpermissao
		End Get
		Set(ByVal value As Integer)
			_cd_perfilpermissao = value
		End Set
	End Property

    <BelongsTo("cd_perfil")> _
    Public Property Perfil() As Perfil
        Get
            Return _Perfil
        End Get
        Set(ByVal value As Perfil)
            _Perfil = value
        End Set
    End Property

    <BelongsTo("cd_permissao")> _
    Public Property Permissao() As Permissao
        Get
            Return _Permissao
        End Get
        Set(ByVal value As Permissao)
            _Permissao = value
        End Set
    End Property

    Public Shared Function FindByPerfil(ByVal perfil As Perfil) As IList
        Return FindAll(GetType(Perfilpermissao), Criterion.Expression.Eq("Perfil", perfil))
    End Function

    'Public Shared Function FindByPermissao(ByVal permissao As Permissao) As Perfilpermissao
    '    Return FindAll(GetType(Perfilpermissao), Expression.Eq("Permissao", permissao))
    'End Function


    <[Property]("perfilpermissao_status")> _
    Public Property perfilpermissao_status() As Short
        Get
            Return _perfilpermissao_status
        End Get
        Set(ByVal value As Short)
            _perfilpermissao_status = value
        End Set
    End Property
End Class
